const z_baseDao = require("@/dao/z_base");
const UserInfoModel = require("@/model/UserInfo");
const { ErrorCode } = require("@/utils/r/code");

const email = {
  async HasEmail(email) {
    const existByEmail = await z_baseDao.GetOne(UserInfoModel.UserInfo, {
      email,
    });
    if (existByEmail && existByEmail.id) {
      return ErrorCode.ERROR_EMAIL_HAS_EXIST;
    }
    return ErrorCode.OK;
  },
};

module.exports = email;
